
package com.prs.util;

import org.apache.commons.validator.GenericValidator;

public class NameUtil {
    public  static String getFullNameLFM(String firstname,String lastname, String middlename){
        StringBuilder name=new StringBuilder();
        if(!GenericValidator.isBlankOrNull(lastname)){
            name.append(lastname);
        }
        if(!GenericValidator.isBlankOrNull(firstname)){
            name.append(" ").append(firstname);
        }
        if(!GenericValidator.isBlankOrNull(middlename)){
            name.append(" ").append(middlename);
        }
        if(GenericValidator.isBlankOrNull(lastname)&&GenericValidator.isBlankOrNull(firstname)&&GenericValidator.isBlankOrNull(middlename)){
            name.append("No name");
        }
        return name.toString();
    }
     public  static String getFullNameFML(String firstname,String lastname, String middlename){
        StringBuilder name=new StringBuilder();
        
        if(!GenericValidator.isBlankOrNull(firstname)){
            name.append(firstname);
        }
        if(!GenericValidator.isBlankOrNull(middlename)){
            name.append(" ").append(middlename);
        }
        if(!GenericValidator.isBlankOrNull(lastname)){
            name.append(" ").append(lastname);
        }
        if(GenericValidator.isBlankOrNull(lastname)&&GenericValidator.isBlankOrNull(firstname)&&GenericValidator.isBlankOrNull(middlename)){
            name.append("No name");
        }
        return name.toString();
    }
}
